<?php

namespace core\db;


use MongoDB\Client;

class CMongo
{

    public function instance()
    {
        // https://docs.mongodb.com/php-library/current/tutorial/crud/

        $collection = (new Client('mongodb://127.0.0.1/', ['password' => 'ioio', 'username' => 'li']))->memory->account;
        $count = $collection->countDocuments();
        $typeMap = $collection->getTypeMap();
        $find = $collection->find()->toArray();

        var_dump(compact('count', 'typeMap', 'find'));
        return $this;
    }
}